Become a Pro / website · becomeapro.ai / src / app / api / auth / [...path] / route.ts
| 1 | import { resourceAuth } from "@/lib/d1-auth"; |
| 2 | import { biolockRoute } from "@/lib/biolock/routes"; |
| 3 | |
| 4 | export const dynamic = "force-dynamic"; |
| 5 | |
| 6 | const BIOLOCK = "/api/auth/biolock/"; |
| 7 | |
| 8 | export function GET(request: Request) { |
| 9 | const path = new URL(request.url).pathname; |
| 10 | if (path === "/api/auth/get-session") return resourceAuth().handler(request); |
| 11 | if (path === BIOLOCK + "devices") return biolockRoute(request, "devices"); |
| 12 | return new Response(null, { status: 404 }); |
| 13 | } |
| 14 | |
| 15 | export function POST(request: Request) { |
| 16 | const path = new URL(request.url).pathname; |
| 17 | if (path === "/api/auth/sign-out") return resourceAuth().handler(request); |
| 18 | if (path.startsWith(BIOLOCK)) return biolockRoute(request, path.slice(BIOLOCK.length)); |
| 19 | return new Response(null, { status: 404 }); |
| 20 | } |